package com.heima.tess4j;

import net.sourceforge.tess4j.ITesseract;
import net.sourceforge.tess4j.Tesseract;
import net.sourceforge.tess4j.TesseractException;

import java.io.File;

public class Application {

    public static void main(String[] args) throws TesseractException {

        //创建一个对象  Tesseract
        ITesseract tesseract = new Tesseract();

        //设置语言
        tesseract.setLanguage("chi_sim");

        //设置语言库的路径
        tesseract.setDatapath("D:\\workspace\\tessdata");

        //识别图片
        File file = new File("D:\\446.jpg");
        String result = tesseract.doOCR(file);
        System.out.println(result);
    }
}
